//求一个3*3矩阵对角线元素之和
public class Program29 {
    public static void main(String[] args) {
        //假定该矩阵为一个整型数3*3矩阵
        int[][] matrix = new int[][]{{10,5,8},{9,6,3},{7,4,1}};
        int sum = 0;
        for (int i = 0; i < 3; i++) {
            sum += matrix[i][i];
        }
        System.out.println(sum);
    }
}
